<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page import="java.util.List" %>
<%@ page import="net.zjitc.domain.User" %>
<%@ page import="java.util.ArrayList" %>

<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023/6/1
  Time: 13:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>用户列表</title>
</head>
<body>

<%--创建一个list对象，里面放3个User，遍历输出user的信息，每一行要求使用h2标题的样式--%>

<%
//    创建一个list对象，里面放3个User
    List<User> list = new ArrayList<>();
    list.add(new User("zhang1","123456"));
    list.add(new User("zhang2","123456"));
    list.add(new User("zhang3","123456"));
%>
<%--jsp:java片段 ，自动拼接--%>
    <c:forEach items="<%=list%>" var="u" step="1" begin="1" varStatus="count">
        ${count.begin} <h2>${u.username} ,${u.password} </h2>
    </c:forEach>

</body>
</html>
